package annotations;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

import org.junit.Test;

public class AnnoTest {

	@Test
	public void aaa() {
		Class<Example> c = Example.class;
		for (Field f : c.getFields()) {
			System.out.println();
			System.out.println(f);
			// annotation directe des proprietes
			Info info = f.getAnnotation(Info.class);
			if (info != null) {
				System.out.print("INFO : ");
				System.out.println(info);
			}
			// annotation indirect par construction (voir Comment)
			for (Annotation a : f.getAnnotations()) {
				info = a.annotationType().getAnnotation(Info.class);
				if (info != null) {
					System.out.println(a);
					System.out.print("INFO2 : ");
					System.out.println(info);
				}
			}
		}
	}

}
